package com.nondo.dean.platform.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * @author xiaofan
 * @Description:
 * @throws
 * @date 2018-04-1310:34
 * @Version 0.1
 */
@Component
public interface UserExtendsMapper {

    /**
     * 修改客户类型
     * @param
     * @param userNo
     * @return
     */
    @Update("update user set user_type='总代客户' " +
            " where region_id in (" +
                             "select id from region where name in " +
                             "('河北','辽宁','吉林','黑龙江','内蒙古','天津')) " +
                             "and user_no=#{userNo,jdbcType=VARCHAR}")
    int updateUserType(String userNo);


    /**
     * 修改经销商对应的接单员
     * @param regionId
     * @param userId
     * @param orderTakeUser
     * @return
     */
    @Update("update user set order_take_user=#{orderTakeUser,jdbcType=VARCHAR}" +
            " where find_in_set(region_id,#{regionId}) or find_in_set(id,#{userId})")
    int updateClerkOrdering(@Param("regionId")String regionId, @Param("userId")String userId, @Param("orderTakeUser")String orderTakeUser);

}
